home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-28 | 1.9 KB | 66 lines | [TEXT/CWIE] |
- // PointObject.h
-
- #ifndef PointObject_h
- #define PointObject_h
-
- #ifndef Integers_h
- #include "Integers.h"
- #endif
-
- class PointObject: public Point
- {
- public:
- PointObject() {}
- PointObject( Point p ) : Point( p ) {}
- PointObject( int16 x, int16 y ) { h = x; v = y; }
-
- static const PointObject zero;
-
- static const PointObject up;
- static const PointObject left;
- static const PointObject down;
- static const PointObject right;
-
- static const PointObject upLeft;
- static const PointObject upRight;
- static const PointObject downLeft;
- static const PointObject downRight;
-
- void operator=( Point p ) { *(Point *)this = p; }
-
- bool operator==( PointObject r ) const { return h == r.h && v == r.v; }
- bool operator!=( PointObject r ) const { return h != r.h || v != r.v; }
-
- bool AboveLeftOf( PointObject r ) const { return h >= r.h && v >= r.v; }
- bool BelowLeftOf( PointObject r ) const { return h >= r.h && v <= r.v; }
- bool AboveRightOf( PointObject r ) const { return h <= r.h && v >= r.v; }
- bool BelowRightOf( PointObject r ) const { return h <= r.h && v <= r.v; }
-
- void BeAboveLeftOf( PointObject r );
- void BeBelowLeftOf( PointObject r );
- void BeAboveRightOf( PointObject r );
- void BeBelowRightOf( PointObject r );
-
- void operator+=( PointObject r );
- void operator-=( PointObject r );
- void operator*=( int16 n );
- void operator/=( int16 n );
-
- PointObject operator+() const { return *this; }
- PointObject operator-() const;
- PointObject operator+( PointObject r ) const;
- PointObject operator-( PointObject r ) const;
- PointObject operator*( int16 n ) const;
- PointObject operator/( int16 n ) const;
-
- uint32 NormSquared() const;
- uint32 TaxicabNorm() const;
-
- uint32 TaxicabDistanceTo( Point ) const;
-
- void GlobalToLocal() { ::GlobalToLocal( this ); }
- void LocalToGlobal() { ::LocalToGlobal( this ); }
- };
-
- #endif
-